<template>
    <div>
        <div>创建时间：{{ bundle_detail.created_time }}</div>
			<div>详情描述：{{ bundle_detail.description }}</div>
			<div>BUNDLE_ID：{{ bundle_detail.bundle_id }}</div>
			<div>名称：{{ bundle_detail.name }}</div>
			<div>平台：{{ bundle_detail.platform }}</div>
			<Form
				ref="formInline"
				:model="formInline"
			>
				<Form-item
					label="状态"
				>
					<Select
						v-model="formInline.status"
						style="width:200px;"
					>
						<Option
							v-for="item in status_select"
							:value="item.value"
							:key="item.label"
						>
							{{ item.label }}
						</Option>

					</Select>
				</Form-item>

                <Form-item
                >
				<Button
					type="primary"
					name="create__submit"
					@click="handleSubmit()">
					 更新 
				</Button>
			</Form-item>
			</Form>
        </div>
</template>
<script>
export default {
    props:{
        bundle_detail:{
            type:Object,
       		default() {
				return {};
			},
        }
    },
    data() {
        return {
            formInline: {
				status: '', // 状态
			},
            status_select: [
				  {
					  label: 'normal',
					  value: 'normal',
				  },
				  {
					  label: 'user-locked',
					  value: 'user-locked',
				  },
			],
        }
    },
    created() {
        this.initForm()
    },
    methods: {
        // 初始化获取status的值
        initForm(){
           this.formInline.status=this.bundle_detail.status
           
        },
        /*
           提交更新
        */
          
        handleSubmit(){
            this.$emit('update', this.bundle_detail.id,this.changeValue())
        },

        /*
        转换提交的状态值
        */
        changeValue(){
              if (this.formInline.status==='normal') {
                  return 0
              }else{
                  return 1
              }
        }
    },
}
</script>